# Contributor: Dan Theisen <djt@hxx.in>
# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Dan Theisen <djt@hxx.in>
pkgname=tcsh
pkgver=6.22.02
pkgrel=1
pkgdesc="extended C-shell"
url="https://github.com/tcsh-org/tcsh"
arch="all"
license="BSD-3-Clause"
checkdepends="diffutils autoconf"
makedepends="ncurses-dev"
install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-deinstall"
subpackages="$pkgname-doc"
_tarball="TCSH6_21_00"
source="tcsh-$pkgver.tar.gz::https://github.com/tcsh-org/tcsh/archive/$_tarball.tar.gz
	001-sysmalloc.patch
	csh.login
	csh.cshrc
	"

builddir="$srcdir/$pkgname-$_tarball"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--bindir=/bin \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-rpath
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm0644 "$srcdir/csh.cshrc" "$pkgdir/etc/csh.cshrc"
	install -Dm0644 "$srcdir/csh.login" "$pkgdir/etc/csh.login"
	ln -s tcsh "$pkgdir/bin/csh"
	ln -s tcsh.1 "$pkgdir/usr/share/man/man1/csh.1"
	rm -rf "$pkgdir"/usr/share/locale
}

sha512sums="305380fd065ca4703ffba002358b41727056481573a78301cb8c2390d5fe1a4107af5d482db5abf26f0ce9f7193c8aeb0e34fedcc40971499be2e6dc13bf3405  tcsh-6.22.02.tar.gz
40149d8eb2fc0fe5184f3c24c7a1b728e881cc0048ccd37a986c3b2d2094499ec1c37ae2bae4c209fb8a847aa943e83e81f79e3d2f55c59990bc00d9d07f5a94  001-sysmalloc.patch
331dd02a5cf64fa281226ab0895c07557015895fe1079894c6d2162827f3e8b07a99245be1de93c93a8f0dfa136c447eae5a5a9d41352157743ff03f6ccb9b23  csh.login
205628d2f0825aab9a1eb3b33b4de2377d010dbb3a098388fb11febda10ca2385ecacaa27c5428dbd7d9d711c913cddca72379c825bfb63385ebc3643253cb37  csh.cshrc"
